package com.iknow.xmpp.smack.avatar;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

public class HttpClientAvatarRetriever
  implements AvatarRetriever
{
  private HttpClient mClient;
  private String mUrl;

  public HttpClientAvatarRetriever(String paramString)
  {
    this.mUrl = paramString;
    this.mClient = new DefaultHttpClient();
  }

  public HttpClientAvatarRetriever(HttpClient paramHttpClient, String paramString)
  {
    this.mUrl = paramString;
    this.mClient = paramHttpClient;
  }

  // ERROR //
  public byte[] getAvatar()
    throws java.io.IOException
  {
    // Byte code:
    //   0: new 31	org/apache/http/client/methods/HttpGet
    //   3: dup
    //   4: aload_0
    //   5: getfield 17	com/iknow/xmpp/smack/avatar/HttpClientAvatarRetriever:mUrl	Ljava/lang/String;
    //   8: invokespecial 33	org/apache/http/client/methods/HttpGet:<init>	(Ljava/lang/String;)V
    //   11: astore_1
    //   12: aload_0
    //   13: getfield 22	com/iknow/xmpp/smack/avatar/HttpClientAvatarRetriever:mClient	Lorg/apache/http/client/HttpClient;
    //   16: aload_1
    //   17: invokeinterface 39 2 0
    //   22: invokeinterface 45 1 0
    //   27: invokeinterface 51 1 0
    //   32: astore_2
    //   33: new 53	java/io/ByteArrayOutputStream
    //   36: dup
    //   37: invokespecial 54	java/io/ByteArrayOutputStream:<init>	()V
    //   40: astore_3
    //   41: sipush 1024
    //   44: newarray byte
    //   46: astore 5
    //   48: aload_2
    //   49: aload 5
    //   51: invokevirtual 60	java/io/InputStream:read	([B)I
    //   54: istore 6
    //   56: iload 6
    //   58: bipush 255
    //   60: if_icmpne +57 -> 117
    //   63: aload_2
    //   64: invokevirtual 63	java/io/InputStream:close	()V
    //   67: aload_3
    //   68: invokevirtual 64	java/io/ByteArrayOutputStream:close	()V
    //   71: aload_3
    //   72: invokevirtual 67	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   75: areturn
    //   76: astore 7
    //   78: new 27	java.io.IOException
    //   81: dup
    //   82: new 69	java/lang/StringBuilder
    //   85: dup
    //   86: ldc 71
    //   88: invokespecial 72	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   91: aload_0
    //   92: getfield 17	com/iknow/xmpp/smack/avatar/HttpClientAvatarRetriever:mUrl	Ljava/lang/String;
    //   95: invokevirtual 76	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   98: invokevirtual 80	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   101: invokespecial 81	java.io.IOException:<init>	(Ljava/lang/String;)V
    //   104: astore 8
    //   106: aload 8
    //   108: aload 7
    //   110: invokevirtual 85	java.io.IOException:initCause	(Ljava/lang/Throwable;)Ljava/lang/Throwable;
    //   113: pop
    //   114: aload 8
    //   116: athrow
    //   117: aload_3
    //   118: aload 5
    //   120: iconst_0
    //   121: iload 6
    //   123: invokevirtual 89	java/io/ByteArrayOutputStream:write	([BII)V
    //   126: goto -78 -> 48
    //   129: astore 4
    //   131: aload_2
    //   132: invokevirtual 63	java/io/InputStream:close	()V
    //   135: aload_3
    //   136: invokevirtual 64	java/io/ByteArrayOutputStream:close	()V
    //   139: aload 4
    //   141: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   0	12	76	java/lang/IllegalArgumentException
    //   41	56	129	finally
    //   117	126	129	finally
  }
}